package com.diver.flinkdemo.entity.xxt;



import com.diver.flinkdemo.utils.base.PagedList;

import java.io.Serializable;
import java.util.List;

/**
 * @author guofy
 * @create 18/8/30 下午1:48
 * <p>
 * desc
 **/
public class PageResponse<V> implements Serializable {

    private static final long serialVersionUID = -4734867686742451050L;

    private long total; //总行数
    private List<V> rows; //数据列表

    public static <V> PageResponse<V> getInstance(PagedList<V> pageList) {
        PageResponse<V> result = new PageResponse();
        if (null != pageList) {
            result.setTotal((long)pageList.getTotalSize());
            result.setRows(pageList.getList());
        }
        return result;
    }

    public static <V> PageResponse<V> getInstance(long total, List<V> rows) {
        PageResponse<V> result = new PageResponse();
        result.setTotal(total);
        result.setRows(rows);
        return result;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List<V> getRows() {
        return rows;
    }

    public void setRows(List<V> rows) {
        this.rows = rows;
    }
}
